Skip to content

Conversation

@sorairolake
Copy link
Contributor

@sorairolake sorairolake commented Nov 10, 2025

This pull request adds a method to the unsigned NonZero<T> that return the minimum number of bits required to represent a value.

This can be achieved by using the get method and the methods added in #142328, but I think adding the NonZero::bit_width method is useful because it accomplishes the same thing a little more succinctly.

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 10, 2025
@rustbot
Copy link
Collaborator

rustbot commented Nov 10, 2025

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@sorairolake
Copy link
Contributor Author

@rustbot label +T-libs-api -T-libs

r? libs-api

@rustbot rustbot added T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. and removed T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 14, 2025
@rustbot rustbot assigned the8472 and unassigned scottmcm Nov 14, 2025
@hanna-kruppe
Copy link
Contributor

Can’t this return NonZeroU32? That would be a good argument for a dedicated NonZero method instead of delegating to get().

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants